package com.dfbz.demo01_缓存字节流;

import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;

/**
 * @author lscl
 * @version 1.0
 * @intro:
 */
public class Demo04_转换流小练习 {
    public static void main(String[] args) throws Exception{

        InputStreamReader isr = new InputStreamReader(
                new FileInputStream("C:\\Users\\Administrator\\Desktop\\words.txt"),
                "GBK");

        OutputStreamWriter osw = new OutputStreamWriter(
                new FileOutputStream("C:\\Users\\Administrator\\Desktop\\copy.txt")
                , "UTF-8"
        );

        int data;

        while ((data =isr.read())!=-1){
            osw.write(data);
        }

        isr.close();
        osw.close();
    }
}
